-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow addition of an entry by its Id (e.g., DOI, ISBN) - fixes #4183 #550 #5755
Conversation
…e un dialog avec un textfield pour un id dont le Fetcher est trouvé par Regex.
avancée issue 4183 : reste travail sur pattern, beauté affichage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some first comments.
Could you please provide screenshots so that there is no need to run JabRef locally to provide a timely feedback?
@@ -12,35 +12,43 @@ | |||
<?import javafx.scene.layout.GridPane?> | |||
<?import javafx.scene.layout.RowConstraints?> | |||
<?import javafx.scene.layout.VBox?> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this reformatting in the file? Can't the file be kept as is?
|
||
final BibEntry entry = result.get(); | ||
|
||
String entryString = "Found with : \n" + fetcherName + "\n\n with ID : \n" + entry.getId() + "\n\n Title : \n" + entry.getTitle() + "\n\n Publication date : \n" + entry.getPublicationDate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please localize that. I think, wrapping in Localizaion.lang is the thing you are searching for.
Please no spaces before the :
.
import org.jabref.logic.importer.IdBasedFetcher; | ||
import org.jabref.logic.importer.NoFetcherFoundException; | ||
import org.jabref.logic.importer.WebFetchers; | ||
import org.jabref.logic.importer.fetcher.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your workspace doesn't seem to be fully setup according to https://github.com/JabRef/jabref/wiki/Guidelines-for-setting-up-a-local-workspace
We don't have imports with *
. Please ensure that you followed all steps given there.
} | ||
} else { | ||
// Regenerate CiteKey of imported BibEntry | ||
new BibtexKeyGenerator(basePanel.getBibDatabaseContext(), prefs.getBibtexKeyPatternPreferences()).generateAndSetKey(entry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cleanup for the bibtex key should be used here - don't we have such a cleanupper? (Reason: consistency with other JAbRef Code).
} | ||
} | ||
|
||
private class FetcherWorker extends Task<Optional<BibEntry>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't JabRef have an infrastructure for background tasks somehow? Maybe, this is a TODO. The current code here feels a bit quickly hacked. At least, this nested class should be factored out to a separate class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BackgroundTask
class is perfectly made for such cases.
} else { | ||
EntryTypeView typeChoiceDialog = new EntryTypeView(jabRefFrame.getCurrentBasePanel(), dialogService, preferences); | ||
EntryType selectedType = typeChoiceDialog.showAndWait().orElse(null); | ||
if (fromID){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boolean parameters should not be used. This smells for a second method (or enums - see http://media.pragprog.com/titles/javacomp/split.pdf)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should actually be a completely new class.
@@ -91,6 +91,8 @@ Automatically\ remove\ exact\ duplicates=Supprimer automatiquement les doublons | |||
|
|||
AUX\ file\ import=Importation de fichier AUX | |||
|
|||
author= Auteur |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thin, "author"
is not used in the code. This string is obsolete.
Please translate full sentences instead of part of sentences.
@@ -1258,6 +1269,7 @@ Your\ style\ file\ specifies\ the\ character\ format\ '%0',\ which\ is\ undefine | |||
Your\ style\ file\ specifies\ the\ paragraph\ format\ '%0',\ which\ is\ undefined\ in\ your\ current\ OpenOffice/LibreOffice\ document.=Your style file specifies the paragraph format '%0', which is undefined in your current OpenOffice/LibreOffice document. | |||
|
|||
Searching...=Searching... | |||
Adding...= Adding ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not have spaces before/after a translation.
Adding...=Adding...
@@ -394,6 +396,8 @@ Formatter\ name=Nom de formateur | |||
|
|||
found\ in\ AUX\ file=trouvées dans le fichier AUX | |||
|
|||
FromID= Entrez l'identifiant comme un ISBN, DOI, ou Arxiv dans le champ ci-dessous |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key has to be the full sentence in English.
@@ -259,6 +260,7 @@ private void setupActions() { | |||
|
|||
actions.put(Actions.SAVE_SELECTED_AS_PLAIN, saveAction::saveSelectedAsPlain); | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please not two empty lines between statements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your contribution. The code looks already pretty good. I've some suggestions concerning the general architecture.
} | ||
} | ||
|
||
private class FetcherWorker extends Task<Optional<BibEntry>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BackgroundTask
class is perfectly made for such cases.
} else { | ||
EntryTypeView typeChoiceDialog = new EntryTypeView(jabRefFrame.getCurrentBasePanel(), dialogService, preferences); | ||
EntryType selectedType = typeChoiceDialog.showAndWait().orElse(null); | ||
if (fromID){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should actually be a completely new class.
|
||
import org.jabref.JabRefException; | ||
|
||
public class NoFetcherFoundException extends RuntimeException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this really needs an exception. Normally, you don't want to use an exception to control the flow of the execution and "No fetcher found" doesn't sound like an abnormal situation but more like a special situation in a normal workflow.
*/ | ||
public static HashMap<Predicate<String>,IdBasedFetcher> getHashMapPredicateIdBasedFetchers(ImportFormatPreferences importFormatPreferences) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better if the IdBasedFetcher
interface is extended by a method boolean matchIdentifier(string identifier)
, which then is implemented by each fetcher. In this way, the fetcher itself is responsible to decide which identifier it is able to match.
@CarodePourtales May I ask whether you find time to complete this pull request? We would really like to include that feature in JabRef. Is there something that we can do to support you to adress the comments? |
b8ef7b7
to
21c6e5e
Compare
@CarodePourtales any update on this? It would be sad if your good work would be lost. Since only a few polishing changes are required, this shouldn't take long. Thanks! |
On JabCon 2020, we decided to freeze this PR and focus on the other opened PRs. We will come back to this issue as soon as our resources are free for it. |
60bf7d5 Add encyclopedia type to wikipedia-templates.csl (#5778) 031afe1 Update and rename dependent/organization-studies.csl to organization-… (#5779) 7ed71e7 Update harvard-newcastle-university.csl (#5765) 46bab91 Update annals-of-oncology.csl (#5760) 6158ae6 Create research-in-plant-disease.csl (#5738) 04422a8 Create chemmedchem.csl (#5753) 7c11521 Create clinical-kidney-journal.csl (#5749) e7ee983 Create kit-karlsruher-institut-fur-technologie-germanistik-ndl-neuere… (#5729) 96a1106 Update article format for STM journal (#5755) a4ca057 Update historia-scribere.csl (#5748) git-subtree-dir: buildres/csl/csl-styles git-subtree-split: 60bf7d5
Creation of a button which opens a dialog.
Only one textfield for an id
Regex on the id to know the fetcher
3 buttons : cancel, look the source and generate
#4183 #550
-->